﻿using OsPortal;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for clsQuaTang
/// </summary>
public class clsQuaTang
{
    static string strClassName = "clsQuaTang";
    public struct stQuaTang
    {
        public int QT_ID;
        public String QT_HOTEN;
        public String QT_EMAIL;
        public String QT_PHONE;
        public String QT_KHUVUC;
        public String QT_LINHVUC;
        public String QT_KENH;
        public String QT_CHIASE;
        public int QT_STATUS;
    }

	public clsQuaTang()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    /// <summary>
    /// Thêm sửa, xóa khách đăng ký quà tặng
    /// </summary>
    /// <param name="objTinDang"></param>
    /// <param name="strMod"></param>
    /// <returns></returns>
    public static string fncQuaTang_Act(stQuaTang objQuaTang, string strMod)
    {
        try
        {
            DataTable dt = oSqlDataHelper.sExecuteDataTable("QUATANG_ACT", new SqlParameter[]{
                new SqlParameter("@P_MOD",strMod),
                new SqlParameter("@P_QT_ID",objQuaTang.QT_ID),
                new SqlParameter("@P_QT_HOTEN",objQuaTang.QT_HOTEN),
                new SqlParameter("@P_QT_EMAIL",objQuaTang.QT_EMAIL),
                new SqlParameter("@P_QT_PHONE",objQuaTang.QT_PHONE),
                new SqlParameter("@P_QT_KHUVUC",objQuaTang.QT_KHUVUC),
                new SqlParameter("@P_QT_LINHVUC",objQuaTang.QT_LINHVUC),
                new SqlParameter("@P_QT_KENH",objQuaTang.QT_KENH),
                new SqlParameter("@P_QT_CHIASE",objQuaTang.QT_CHIASE),
                new SqlParameter("@P_QT_STATUS",objQuaTang.QT_STATUS),
            });
            if (dt == null) return "";
            if (dt.Rows.Count <= 0) return "";

            string strResult = dt.Rows[0]["ERRNAME"].ToString();
            return strResult;
        }
        catch (Exception ex)
        {
            oFileHelper.WriteLogErr(strClassName, "fncPhongTro_Act", ex.ToString());
            return "Có lỗi phát sinh! Vui lòng liên hệ BQT";
        }
    }
}